home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Visual Basic 6.0 Utilities / Multi-Language Add-In for Visual Basic 6.0 / MultiLang.msi / _7CE13D500B6511D5BE510020182C1E5C (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-12-10  |  4.6 KB  |  125 lines

  1. VERSION 5.00
  2. Begin VB.Form LanguageSelect 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Select Language"
  5.    ClientHeight    =   2796
  6.    ClientLeft      =   36
  7.    ClientTop       =   336
  8.    ClientWidth     =   5088
  9.    Icon            =   "LanguageSelect.frx":0000
  10.    LinkTopic       =   "Form2"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   2796
  14.    ScaleWidth      =   5088
  15.    ShowInTaskbar   =   0   'False
  16.    StartUpPosition =   2  'CenterScreen
  17.    Begin VB.CheckBox chkShowOnStartup 
  18.       Caption         =   "Show this dialog when the program starts"
  19.       Height          =   252
  20.       Left            =   120
  21.       TabIndex        =   2
  22.       Top             =   2280
  23.       Width           =   3492
  24.    End
  25.    Begin VB.CommandButton OkButton 
  26.       Caption         =   "OK"
  27.       Default         =   -1  'True
  28.       Height          =   372
  29.       Left            =   3840
  30.       TabIndex        =   1
  31.       Top             =   2280
  32.       Width           =   1092
  33.    End
  34.    Begin VB.ListBox LanguageList 
  35.       Height          =   1968
  36.       Left            =   120
  37.       TabIndex        =   0
  38.       Top             =   120
  39.       Width           =   4812
  40.    End
  41. Attribute VB_Name = "LanguageSelect"
  42. Attribute VB_GlobalNameSpace = False
  43. Attribute VB_Creatable = False
  44. Attribute VB_PredeclaredId = True
  45. Attribute VB_Exposed = False
  46. Option Explicit
  47. Private ShowOnStartup As Boolean
  48. Public Sub ShowDialog(Optional ByVal IsStartup As Boolean = True)
  49.   Load Me
  50.   'This function can be called from Sub Main to:
  51.   '- read settings from the registry and
  52.   '- show the LanguageSelect Dialog.
  53.   'The LanguageSelect dialog has a check box to specify whether it
  54.   'should be shown on startup. Your program should provide some method
  55.   'other method to show this dialog, if the user disables it!
  56.   'The VB SaveSetting/GetSetting functions store the settings in
  57.   '"HKEY_CURRENT_USER\Software\VB and VBA Program Settings".
  58.   'You may want to replace these functions with Windows API functions
  59.   'to store the settings somewhere else, such as
  60.   '"HKEY_CURRENT_USER\Software\<my company>".
  61.   If IsStartup Then
  62.     Dim LangId As Long
  63.     Dim Lang As String
  64.     'Read settings from registry
  65.     LangId = GetSetting(App.EXEName, "MultiLang", "LangId", ml_OriginalLanguage)
  66.     Lang = GetSetting(App.EXEName, "MultiLang", "LangName")
  67.     'Select the language specified in the registry
  68.     ml_ChangeLanguage LangId, Lang
  69.     'Store the language in the runtime support object, so that seperately 
  70.     'compiled components (.ocx, .dll) can start up in the same language.
  71. '    Set ml_RuntimeSupport = New MLSupport                                   'MLRUNTIMESUPPORT
  72. '    ml_RuntimeSupport.SetLanguage LangId, Lang                              'MLRUNTIMESUPPORT
  73.   End If
  74.   'Always read the ShowOnStartup flag from the registry
  75.   ShowOnStartup = GetSetting(App.EXEName, "MultiLang", "ShowDialog", True)
  76.   'Initialise controls on the form
  77.   InitialiseForm
  78.   'Show the language select dialog, unless the user deselected this option.
  79.   If ShowOnStartup Or Not IsStartup Then
  80.     Me.Show vbModal
  81.           
  82.     'Save settings in the registry
  83.     SaveSetting App.EXEName, "MultiLang", "LangId", ml_CurrentLanguageId
  84.     SaveSetting App.EXEName, "MultiLang", "LangName", ml_LanguageName(ml_CurrentLanguageId)
  85.     SaveSetting App.EXEName, "MultiLang", "ShowDialog", ShowOnStartup
  86.   End If
  87.   Unload Me
  88. End Sub
  89. Private Sub InitialiseForm()
  90.   Dim Index      As Long
  91.   Dim LanguageID As Long
  92.   Dim LanguageArray
  93.   LanguageArray = ml_LanguageIds
  94.   With LanguageList
  95.     .Clear
  96.     For Index = LBound(LanguageArray) To UBound(LanguageArray)
  97.       LanguageID = LanguageArray(Index)
  98.       .AddItem ml_LocaleName(LanguageID)
  99.       .ItemData(.NewIndex) = LanguageID
  100.       
  101.       If LanguageID = ml_CurrentLanguageId Then
  102.         .Selected(Index) = True
  103.       End If
  104.     Next
  105.   End With
  106.   chkShowOnStartup.Value = IIf(ShowOnStartup, vbChecked, vbUnchecked)
  107. End Sub
  108. Private Sub LanguageList_DblClick()
  109.   OkButton_Click
  110. End Sub
  111. Private Sub OkButton_Click()
  112.   With LanguageList
  113.     If .ListIndex <> -1 Then
  114.       ShowOnStartup = (chkShowOnStartup = vbChecked)
  115.       ml_CurrentLanguageId = .ItemData(.ListIndex)
  116. '      ml_RuntimeSupport.SetLanguage ml_CurrentLanguageId, ml_LanguageName(ml_CurrentLanguageId)    'MLRUNTIMESUPPORT
  117.       Me.Hide
  118.       
  119.     End If
  120.   End With
  121. End Sub
  122. Private Sub ml_UpdateControls()
  123.   'Dummy
  124. End Sub
  125.